<template>
  <div class="app-container">
    <el-container class="main-container">
      <el-header class="header">后台管理页面</el-header>
      <el-container class="content-container">
        <el-aside width="160px" class="sidebar">
          <el-col :span="12" class="sidebar-content">
            <el-menu
                :default-active="$route.path"
                class="el-menu-vertical-demo"
                text-color="#9fa5af"
                :router="true">
              <el-menu-item v-for="routerItem in children" :index="routerItem.path" :key="routerItem.path">
                <i :class="routerItem.meta.icon"></i>
                <span slot="title">{{ routerItem.meta.title }}</span>
              </el-menu-item>
            </el-menu>
          </el-col>
        </el-aside>
        <el-main class="main-content">
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
import { children } from "@/router/children_router";

export default {
  data() {
    return {
      children
    };
  }
};
</script>

<style scoped>
.app-container {
  height: calc(100vh - 20px); /* 考虑到上下边距，使页面高度为视口高度减去20px */
  background-color: #f4f9fd;
  margin: 10px; /* 设置页面整体边距为10px */
}

.main-container {
  height: 100%;
}

.header {
  background-color: #fff;
  align-items: center;
  display: flex;
  font-weight: bold;
  margin-bottom: 10px;
  border-radius: 15px;
}

.content-container {
  border-radius: 15px;
  overflow: hidden; /* 防止内容溢出 */
}

.sidebar {
  background-color: #fff;
  border-radius: 15px;
  padding-top: 10px;
  margin-right: 10px;
}

.sidebar-content {
  width: 100%;
  font-weight: bold;
}

.main-content {
  background-color: #fff;
  border-radius: 10px;
  padding: 20px;
}
</style>
